<?php
namespace App\Factory\PaymentBehalf;

use App\Utils\Other\Sandpay\PaymentBehalf\PaymentBehalf;
use function Hyperf\Support\make;

Class Factory {

    /**
     * 衫德代付
     * @param array $params
     * @return array
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function sandpay(array $params):array
    {
        /** @var PaymentBehalf $miniPay */
        $miniPay = make(PaymentBehalf::class);
        $data['tranAmt'] = str_repeat('0', 12-strlen((string)($params['amount'] * 100))).($params['amount'] * 100);
        $data['accNo'] = $params['bank_account'];
        $data['accName'] = $params['account_name'];

        return $miniPay->handle($data, $params['type']);
    }

}